/**
 * Simple lexer application, parse input tokens.
 * Variation on code from : "Language Implementation Patterns", Terence Parr
 */
package org.berlin.octane.compiler.lang;

/**
 * Basic token class.
 */
public class VisitorToken {
    
    public static int L_PAREN = 2;
    public static int R_PAREN = 3;
    public static int INTEGER = 4;    
    public static int PLUS = 5;
    
    private int type;    
    private String text;
    
    /**
     * Constructor for Token.
     * 
     * @param type int
     * @param text String
     */
    public VisitorToken(final int type, final String text) {
        this.type = type; 
        this.text = text;
    }
    
    /**
     * Return string representation of token.
     * 
     * @return String
     */
    public String toString() {
        final String tname = VisitorSimpleLexer.name(type);
        return "{'"+text+"',"+tname+"}";
    }

    /**
     * @return the type
     */
    public int getType() {
        return type;
    }

    /**
     * @return the text
     */
    public String getText() {
        return text;
    }
    
} // End of the class //
